package cn.day08;

public class Review {
    public static void main(String[] args) {
        Cat c1=new Cat();
        int age1 = c1.age;
        System.out.println(age1);
        c1.eat();
        Dog d=new Dog();
        Dog d1=new Dog();
        Dog d2=new Dog();
        d.sport();
        d.weight=60.5;
        System.out.println(d.weight);
        System.out.println(d1.weight);
        System.out.println(d2.weight);
        Animal a=new Cat();
        System.out.println(a.AGE);
        a.eat();

    }
}
class Animal{
    double hight;
    static double weight;
    static String food;
    final int AGE=20;


    {
        System.out.println("这是一个代码块");
    }
    static{
        System.out.println("这是一个静态代码块");
    }
    public final void eat(){
        System.out.println("这是animal的eat方法");
    }
    public String speak(){
        System.out.println("这是animal的speak方法");
        return "这是一个return";
    }

    public Animal() {
        System.out.println("这是animal的无参构造");
    }

    public Animal(double hight, int age) {
        this.hight = hight;

        System.out.println("这是animal的全参构造,身高"+hight+"年龄"+age);
    }
    public Animal sport(){
        System.out.println("动物的运动方法");
        return null;
    }
}
class Cat extends Animal{
    double hight;
    static double weight;
    static String food;
    int age=10;

    public Cat(){
        super(23.55, 25);
        hight=0.9;
        super.hight=1.5;
        System.out.println("这是Cat的无参构造");
        System.out.println("猫的成员变量"+hight);
        System.out.println("animal的成员变量"+super.hight);

    }



}
class Dog extends Animal{
    double hight;
    static double weight;
    static String food;
    int age;
    @Override
    public Dog sport(){
        System.out.println("动物的运动方法改写为dog的运动");
        return null;
    }

}
